package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string
	Password string
}

type RealName struct {
	gorm.Model
	UserId   int64
	RealName string
	IdCard   string
}

func (r *RealName) GetRealNameByUserId() error {
	return DB.Where("user_id=?", r.UserId).Limit(1).Find(&r).Error
}

func (r *RealName) CreateRealName() error {
	return DB.Create(&r).Error
}

func (r *RealName) GetRealNameByName() error {
	return DB.Where("real_name=?", r.RealName).Limit(1).Find(&r).Error
}
